// 创建临时文件夹
def tmpDir = File.createTempDir()

// 一开始是空的
assert 0 == tmpDir.directorySize()

File source = new File(tmpDir, 'input.dat')
source.bytes = "hello world".bytes

assert 11 == tmpDir.directorySize()

File destination = new File(tmpDir, 'output.dat')

// 使用 withDataInputStream, withDataOutputStream 复制内容
destination.withDataOutputStream { os -> 
	source.withDataInputStream { is -> 
		os << is
	}
}

assert 22 == tmpDir.directorySize()

// 删除临时文件夹
tmpDir.deleteDir()
